package com.lxy.exportword.service.impl;

import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.data.Pictures;
import com.lxy.exportword.entity.moxi.vo.PipelineTypeVo;
import com.lxy.exportword.entity.shunan.ShuNanAbnormalSituationPoint;
import com.lxy.exportword.entity.shunan.ShuNanGasTrunkLine;
import com.lxy.exportword.entity.shunan.ShuNanHeader;
import com.lxy.exportword.service.IShuNanService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LiuXiaoYu
 * @date 2021/9/13- 14:37
 */
@Service
public class ShuNanServiceImpl implements IShuNanService {

    @Value("${outFile.photoPath}")
    private String photoPath;

    /**
     * 获取蜀南异常情况表模板前两页信息
     * @return ShuNanHeader前两页模板对象
     */
    @Override
    public ShuNanHeader getAllShuNanHeader() {
        return new ShuNanHeader("1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1");
    }

    /**
     * 获取蜀南异常情况表模板集输气干线的所有信息
     * @return List集合
     */
    @Override
    public List<ShuNanGasTrunkLine> getAllShuNanGasTrunkLineList() {
        List<ShuNanGasTrunkLine> shuNanGasTrunkLineList=new ArrayList<>();
        //List<Map<String, PictureRenderData>> list=new ArrayList<>();
        PictureRenderData gasPictureOne= Pictures.ofLocal(photoPath + "蜀南（07.12-07.18）/集输气干线1.png").create();
        PictureRenderData gasPictureTwo= Pictures.ofLocal(photoPath + "蜀南（07.12-07.18）/集输气干线2.png").create();
//        Map<String,PictureRenderData> map1=new HashMap<>();
//        Map<String,PictureRenderData> map2=new HashMap<>();
//        map1.put("gasPictures",gasPictureOne);
//        map2.put("gasPictures",gasPictureTwo);
//        list.add(map1);
//        list.add(map2);
        List<PictureRenderData> list=new ArrayList<>();
        list.add(gasPictureOne);
        list.add(gasPictureTwo);
        ShuNanGasTrunkLine shuNanGasTrunkLine = new ShuNanGasTrunkLine("1","没有管线号","刘1","20.54（*1）","本次巡检无异常",list);
        shuNanGasTrunkLineList.add(shuNanGasTrunkLine);
        shuNanGasTrunkLineList.add(shuNanGasTrunkLine);
        shuNanGasTrunkLineList.add(shuNanGasTrunkLine);
        return shuNanGasTrunkLineList;
    }

    /**
     * 获取蜀南异常情况点的所有信息
     * @return List集合
     */
    @Override
    public List<ShuNanAbnormalSituationPoint> getAllShuNanAbnormalSituationPointList() {
        //封装磨溪异常记录表所有异常情况点的信息
        List<ShuNanAbnormalSituationPoint> shuNanAbnormalSituationPointList = new ArrayList<>();
        ShuNanAbnormalSituationPoint shuNanAbnormalSituationPoint = new ShuNanAbnormalSituationPoint();
        //首先是标题 TODO 每个标签前面要根据这个List有几个变成(例子1.1.1/1.1.2/1.1.3之类的再加上问题描述)
        shuNanAbnormalSituationPoint.setProblemDescription("一级异常情况点（动土）");
        //异常情况巡检图(不止一张) TODO 本来图片地址应该是从数据库中查出来的这只是模拟数据
        List<Map<String,PictureRenderData>> abnormalSituationInspectionChart=new ArrayList<>();
        Map<String,PictureRenderData> map=new HashMap<>();
        Map<String,PictureRenderData> map2=new HashMap<>();
        PictureRenderData inspectionChartOne = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1异常情况巡检图(1).png").create();
        PictureRenderData inspectionChartTwo = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1异常情况巡检图(2).png").create();
        map.put("abnormalSituationInspectionChart",inspectionChartOne);
        map2.put("abnormalSituationInspectionChart",inspectionChartTwo);

        abnormalSituationInspectionChart.add(map);
        abnormalSituationInspectionChart.add(map2);
        shuNanAbnormalSituationPoint.setAbnormalSituationInspectionChart(abnormalSituationInspectionChart);
        //异常情况巡检图(不止一张) TODO 本来图片地址应该是从数据库中查出来的这只是模拟数据
        List<Map<String,PictureRenderData>> anomalyDistributionMap=new ArrayList<>();
        Map<String,PictureRenderData> map3=new HashMap<>();
        Map<String,PictureRenderData> map4=new HashMap<>();
        PictureRenderData anomalyDistributionMapOne = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1异常情况分步图(1).png").create();
        PictureRenderData anomalyDistributionMapTwo = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1异常情况分步图(2).png").create();
        map3.put("anomalyDistributionMap",anomalyDistributionMapOne);
        map4.put("anomalyDistributionMap",anomalyDistributionMapTwo);
        anomalyDistributionMap.add(map3);
        anomalyDistributionMap.add(map4);
        shuNanAbnormalSituationPoint.setAnomalyDistributionMap(anomalyDistributionMap);

        //地点
        shuNanAbnormalSituationPoint.setLocation("遂宁市安居区磨溪镇，距离龙王庙集气总站的直线距离约为4448米。");
        //坐标
        shuNanAbnormalSituationPoint.setCoordinate("105.66637E、30.31133N");
        //TODO 管线类型 先不管不知道怎么做才好
        List<PipelineTypeVo> pipelineTypeVos=new ArrayList<>();
        pipelineTypeVos.add(new PipelineTypeVo("我是管线类型"));
        shuNanAbnormalSituationPoint.setPipelineType(pipelineTypeVos);
        //管线名称
        shuNanAbnormalSituationPoint.setPipelineName("1-3#西眉清管站至龙王庙集气总站");
        //参考依据
        shuNanAbnormalSituationPoint.setReference("《中华人民共和国石油天然气管道保护法》第三十条，在管道线路中心线两侧各五米地域范围内。");
        //情况说明
        shuNanAbnormalSituationPoint.setDescriptionSituation("管线上方5米范围内有动土迹象。");
        //多了一个是视频节点
        shuNanAbnormalSituationPoint.setVideoTimeNode("我是视频时间节点");
        /*-----------------------固定翼/多旋翼巡检-----------*/
        //巡检时间
        shuNanAbnormalSituationPoint.setInspectionTime("07月22日19时16分");
        //无人机飞手
        shuNanAbnormalSituationPoint.setDroneOperator("刘小余");
        //飞行高度
        shuNanAbnormalSituationPoint.setFlyingHeight("100米");
        //焦距倍数
        shuNanAbnormalSituationPoint.setFocalLength("33倍");
        //天气
        shuNanAbnormalSituationPoint.setWeather("十分生气懂吗");
        //温度
        shuNanAbnormalSituationPoint.setTemperature("100000度");

        /*-----------------------数据分析-----------------------*/
        //分析时间
        shuNanAbnormalSituationPoint.setAnalysisTime("07月22日19时16分");
        //分析人员
        shuNanAbnormalSituationPoint.setAnalysts("刘小余");
        /*-----------------------多旋翼排查----------------------*/
        //排查时间
        shuNanAbnormalSituationPoint.setInvestigationTime("07月22日19时16分");
        //无人机飞手
        shuNanAbnormalSituationPoint.setDronePilot("刘小余");
        //排查情况
        shuNanAbnormalSituationPoint.setMultiRotorCheckSituation("哈哈哈哈哈哈哈哈哈哈");
        /*----------------------实地核查---------------------------*/
        //核查时间
        shuNanAbnormalSituationPoint.setCheckTime("07月22日19时16分");
        //核查人员
        shuNanAbnormalSituationPoint.setVerifier("刘小余");
        //核查情况
        shuNanAbnormalSituationPoint.setFieldCheckSituation("管线上方5米范围内有动土迹象。");
        /*----------------------异常情况汇报-------------------------*/
        //汇报时间
        shuNanAbnormalSituationPoint.setReportingTime("07月22日19时16分");
        //汇报人员
        shuNanAbnormalSituationPoint.setReporter("刘小余");
        //甲方接收人
        shuNanAbnormalSituationPoint.setRecipient("刘小余");
        //甲方答复
        shuNanAbnormalSituationPoint.setReply("此处已与施工方确认，做了硬隔离。");
        //汇报证明  TODO 图像大小感觉需要用注解抽取
        List<Map<String,PictureRenderData>> reportCertificate=new ArrayList<>();
        Map<String,PictureRenderData> map5=new HashMap<>();
        Map<String,PictureRenderData> map6=new HashMap<>();
        PictureRenderData reportCertificateOne = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1汇报证明.png").create();
        PictureRenderData reportCertificateTwo = Pictures.ofLocal(photoPath + "磨溪（07.21-07.27）/异常情况点/1.1汇报证明.png").create();
        map5.put("reportCertificate",reportCertificateOne);
        map6.put("reportCertificate",reportCertificateTwo);
        reportCertificate.add(map5);
        reportCertificate.add(map6);
        shuNanAbnormalSituationPoint.setReportCertificate(reportCertificate);

        shuNanAbnormalSituationPointList.add(shuNanAbnormalSituationPoint);
        shuNanAbnormalSituationPointList.add(shuNanAbnormalSituationPoint);
        shuNanAbnormalSituationPointList.add(shuNanAbnormalSituationPoint);
        return shuNanAbnormalSituationPointList;
    }


}
